import java.util.Arrays;
import java.util.Scanner;

/*有n个整数，使其前面各数顺序向后移m个位置
最后m个数变成最前面的m个数 */
public class Exerise_36 {
    public static void main(String[] args) {
        int[] array = new int[10];
        for (int i = 0; i < array.length; i++) {
            array[i] = (int) (Math.random() * 100);
        }
        System.out.println(Arrays.toString(array));
        int m;
        Scanner sc = new Scanner(System.in);
        System.out.println("输入后移的个数");
        m = sc.nextInt();
        int array_1[] = new int[m];
        for (int i = 0; i < m; i++) {
            array_1[i] = array[array.length - m + i];
        }

        for (int i = array.length-1; i >= m; i--) {
                     array[i]=array[i-m];
        }
        for (int i = 0 ;i <m ; i++) {
            array[i]=array_1[i];
        }

        System.out.println(Arrays.toString(array));
    }

}



